package logic

import (
	"context"

	"videoProject/src/videomanage/api/internal/svc"
	"videoProject/src/videomanage/api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type ListVideosLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewListVideosLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListVideosLogic {
	return &ListVideosLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *ListVideosLogic) ListVideos() (resp *types.ListVideoResponse, err error) {
	// todo: add your logic here and delete this line
	// 实现列出所有视频逻辑，例如从数据库中读取所有视频信息
	videos := []types.Video{
		{
			Id:       1,
			Title:    "Sample Video 1",
			Url:      "http://example.com/video1.mp4",
			Duration: 1234,
		},
		{
			Id:       2,
			Title:    "Sample Video 2",
			Url:      "http://example.com/video2.mp4",
			Duration: 5678,
		},
	}
	resp = &types.ListVideoResponse{
		Videos: videos,
	}
	return resp, nil
}
